﻿@model MobilnyDostawca.ViewModels.DostawcyEditViewModel

@{
    ViewBag.Title = "Przydzielanie nowego subregionu";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Przydzielanie nowego subregionu</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Subregiony do przydziału</legend>
            @if (Model.Region != string.Empty) 
            { 
                <div class="display-label">Region</div>
                <div class="display-field">
                @Html.DisplayFor(model => model.Region)
                </div>
            }
            else
            {
                @Html.Label("Dostawca bez przydzielonego subregionu")
            }
            <div class="editor-label">
                @Html.LabelFor(model => model.Subregion, "Subregiony")
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(x => x.Subregion, new SelectList(Model.Subregiony,"Value","Text"),string.Empty)
                @Html.ValidationMessageFor(model => model.Subregion)
            </div>

        <p>
            <input type="submit" value="Przydziel subregion" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Wróć do listy dostawców", "Index")
</div>
